<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<html xmlns="http://www.w3.org/1999/xhtml">

<%@page import="castleContent.Castle"%>
<head>
<script type="text/javascript" src="jquery-2.1.1.js"></script>
<style>

div.Castle {
	margin-top: 5%;
}

div.GoldMine {
	height: 28%;
	width: 26%;
	text-align: center;
}

div.FoodHouse {
	height: 30%;
	width: 26%;
	text-align: center;
	margin-left: 27%;
	margin-top: -15%;
}
</style>

<script>
	function upgradeResourceGetMethod(resourceType) {
		$.get(
				"http://localhost:8080/GameDevelopment/ResourceServlet?resourceType="
						+ resourceType, function(data) {
					$("#Resources").html(data);
				});
	}
	function upgradeGoldMineCapacity() {
		resourceType = "goldMineCapacity";
		upgradeResourceGetMethod(resourceType);
	}
	function upgradeGoldMineProduction() {
		resourceType = "goldMineProduction";
		upgradeResourceGetMethod(resourceType);
	}
	function upgradeFoodHouseCapacity() {
		resourceType = "foodHouseCapacity";
		upgradeResourceGetMethod(resourceType);
	}
	function upgradeFoodHouseProduction() {
		resourceType = "foodHouseProduction";
		upgradeResourceGetMethod(resourceType);
	}
</script>
</head>
<body>
	<%
		Castle castle = (Castle) session.getAttribute("Castle");
	%>
	<h1 id="Resources">
		Food :
		<%=castle.getFoodFarm().getAvailableResource()%>
		Gold :
		<%=castle.getGoldMine().getAvailableResource()%>
		<br> Army : <%=castle.getBarracks().getPresentArmy()%>
		/
		<%=castle.getBarracks().getArmyCapacity()%>
	</h1>

	<div class="GoldMine">
		<H2>Gold Mine Upgrade</H2>
		<div>

			Faster gold gathering.<br> + <%=castle.getGoldMine().getProduction() %> gold / 1min 
			<br> Cost : 500 gold 
			<br>
			<BUTTON onclick="upgradeGoldMineProduction()">Upgrade</BUTTON>
		</div>
		<!--  
		<div>

			Gold capacity.<br> + 5000 gold 
			<br> Cost : 1000 gold 
			<br>
			<BUTTON onclick="upgradeGoldMineCapacity()">Upgrade</BUTTON>
		</div>
		-->
	</div>

	<div class="FoodHouse">
		<H2>Food Store Upgrade</H2>
		<div>

			Faster food gathering.<br> + <%=castle.getFoodFarm().getProduction() %> food / 1min 
			<br> Cost : 500 food 
			<br>
			<BUTTON onclick="upgradeFoodHouseProduction()">Upgrade</BUTTON>
		</div>
		<!--  
		<div>
			Food capacity.<br> + 5000 food 
			<br> Cost : 1000 food 
			<br>
			<BUTTON onclick="upgradeFoodHouseCapacity()">Upgrade</BUTTON>
		</div>
		-->
	</div>
	<button onlclick="getGold()" style="margin-left: 10%">GET GOLD</button>
	<button onlclick="getFood()" style="margin-left: 20%">GET FOOD</button>
	<div class="Castle">
		<a href="HumanCastle.jsp"><img src="Arrow.png" height="15%"
			width="20%" />
	</div>
</body>
</html>